package com.xl.factoryMethodPattern;

/**
 * 简单工厂模式
 */
public class SimpleLoggerFactory {
    public static Logger createLogger(String type) {
        if ("file".equalsIgnoreCase(type)) {
            return new FileLogger();
        } else if ("database".equalsIgnoreCase(type)) {
            return new DatabaseLogger();
        } else {
            throw new IllegalArgumentException("Unknown logger type: "+type);
        }
    }
}
